package com.sky.his.api.mis.controller.form;

import lombok.Data;
import org.springframework.web.bind.annotation.DeleteMapping;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
public class UpdatePasswordForm {

    @NotBlank(message = "password不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9]{6,20}$", message = "password内容不正确")
    private String password;

    @NotBlank(message = "newPassword不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9]{6,20}$", message = "newPassword内容不正确")
    private String newPassword;

    @NotBlank(message = "confirmPassword不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9]{6,20}$", message = "confirmPassword内容不正确")
    private String confirmPassword;

    @AssertTrue(message = "新密码和确认密码不一致")
    public boolean isPasswordMatch() {
        return newPassword != null && newPassword.equals(confirmPassword);
    }


}
